package com;

import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;

/**
 * zuul网关
 * 
 * @author keke
 * @date 2020/06/18
 */
@EnableZuulProxy
@SpringCloudApplication
@EnableFeignClients
public class GatewayApplication {

    public static void main(String[] args) {
        SpringApplication.run(GatewayApplication.class, args);
    }

    /**
     * http auto to https
     * 
     * @return
     */
    /*
    @Bean
    public EmbeddedServletContainerFactory servletContainer() {
    	TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() {
    		@Override
    		protected void postProcessContext(Context context) {
    			SecurityConstraint securityConstraint = new SecurityConstraint();
    			securityConstraint.setUserConstraint("CONFIDENTIAL");// confidential
    			SecurityCollection collection = new SecurityCollection();
    			collection.addPattern("/*");
    			securityConstraint.addCollection(collection);
    			context.addConstraint(securityConstraint);
    		}
    	};
    	tomcat.addAdditionalTomcatConnectors(httpConnector());
    	return tomcat;
    }
    
    public Connector httpConnector() {
    	Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
    	connector.setScheme("http");
    	connector.setPort(httpPort);
    	connector.setSecure(false);
    	connector.setRedirectPort(httpsPort);
    	return connector;
    }
    */
}
